home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1999 September / DPPCPRO0999.ISO / Macromed / Flash2 / CD Extras / WebTools / JBS.DXR / 00008_File viewer code.ls < prev    next >
Encoding:
Text File  |  1997-04-13  |  3.6 KB  |  134 lines

  1. on ShowTileViewer
  2.   global TileFileSize
  3.   set fileName to field "NameDisplay"
  4.   if the machineType = 256 then
  5.     set fPath to GetFilePath(fileName, "bmp")
  6.   else
  7.     set fPath to GetFilePath(fileName, "pic")
  8.   end if
  9.   ActivateViewer(fileName, fPath, TileFileSize)
  10. end
  11.  
  12. on ShowBarViewer
  13.   set fileName to field "NameDisplay"
  14.   if the machineType = 256 then
  15.     set fPath to GetFilePath(fileName, "bmp")
  16.   else
  17.     set fPath to GetFilePath(fileName, "pic")
  18.   end if
  19.   ActivateViewer(fileName, fPath)
  20. end
  21.  
  22. on ShowBtnViewer
  23.   set fileName to field "NameDisplay"
  24.   if the machineType = 256 then
  25.     set fPath to GetFilePath(fileName, "bmp")
  26.   else
  27.     set fPath to GetFilePath(fileName, "pic")
  28.   end if
  29.   ActivateViewer(fileName, fPath)
  30. end
  31.  
  32. on noViewWarning
  33.   set the puppet of sprite 20 to 1
  34.   set oldCast to the castNum of sprite 20
  35.   set the castNum of sprite 20 to the number of cast "NoViewWarn"
  36.   updateStage()
  37.   set dwellDone to the ticks + 90
  38.   repeat while the ticks < dwellDone
  39.   end repeat
  40.   set the castNum of sprite 20 to oldCast
  41.   updateStage()
  42.   set the puppet of sprite 20 to 0
  43. end
  44.  
  45. on ShowIconViewer
  46.   global iconFileMode, PCwindowMode
  47.   set fileName to field "NameDisplay"
  48.   if the machineType = 256 then
  49.     set f1Path to GetFilePath(fileName, "bmp")
  50.   else
  51.     set f1Path to GetFilePath(fileName, "pic")
  52.   end if
  53.   ActivateViewer(fileName, f1Path)
  54. end
  55.  
  56. on ActivateViewer fileName, FullPathName, TileSize
  57.   global LastImportBtn
  58.   if LastImportBtn = 1 then
  59.     set DepthSym to "2-" & string(the colorDepth)
  60.     set LastImportBtn to 2
  61.   else
  62.     set DepthSym to "1-" & string(the colorDepth)
  63.     set LastImportBtn to 1
  64.   end if
  65.   set BtnCastNum to the number of cast ("ButtonCast" & DepthSym)
  66.   if the machineType = 256 then
  67.     set the fileName of cast BtnCastNum to FullPathName
  68.     if the fileName of cast BtnCastNum <> FullPathName then
  69.       alert("Viewer failed to access file: " & FullPathName)
  70.     end if
  71.   else
  72.     set the fileName of cast BtnCastNum to FullPathName
  73.     if the fileName of cast BtnCastNum <> FullPathName then
  74.       alert("Viewer failed to access file: " & FullPathName)
  75.     end if
  76.   end if
  77.   set the picture of cast BtnCastNum to the picture of cast BtnCastNum
  78.   put the width of cast BtnCastNum & ", " & the height of cast BtnCastNum into field "FileStats"
  79.   put fileName into field "PreviewFileName"
  80.   if the paramCount = 3 then
  81.     if TileSize = 64 then
  82.       if the width of cast BtnCastNum < 70 then
  83.         DisplaySmallSquareTiles(BtnCastNum)
  84.       else
  85.         DisplaySmallRectTiles(BtnCastNum)
  86.       end if
  87.     else
  88.       if the width of cast BtnCastNum < 134 then
  89.         DisplayBigSquareTiles(BtnCastNum)
  90.       else
  91.         DisplayBigRectTiles(BtnCastNum)
  92.       end if
  93.     end if
  94.   else
  95.     displayimage(BtnCastNum)
  96.   end if
  97. end
  98.  
  99. on checkRAMspace FileToPreview
  100.   if 1 then
  101.     set F to the freeBytes
  102.     set QTcast to the castNum of sprite 30
  103.     unLoadCast(1, QTcast - 1)
  104.     unLoadCast(QTcast + 1, the number of castMembers)
  105.     put "Cast purge RAM freed: (before) " & F & " , (after) " & the freeBytes
  106.   end if
  107. end
  108.  
  109. on DragClickedSprite
  110.   set ClickedOne to the clickOn
  111.   set clickHandle to point(mouseH(), mouseV()) - the loc of sprite ClickedOne
  112.   repeat while the mouseDown
  113.     set the loc of sprite ClickedOne to point(mouseH(), mouseV()) - clickHandle
  114.     updateStage()
  115.   end repeat
  116. end
  117.  
  118. on IsolateClickedTile
  119.   set ClickedOne to the clickOn
  120.   repeat with i = 24 to 43
  121.     if i <> ClickedOne then
  122.       set the visible of sprite i to 0
  123.     end if
  124.   end repeat
  125.   updateStage()
  126.   KillTicks(30)
  127.   repeat while the mouseDown
  128.   end repeat
  129.   repeat with i = 24 to 43
  130.     set the visible of sprite i to 1
  131.   end repeat
  132.   updateStage()
  133. end
  134.